App.controller('processMineController', ['$scope', '$state', '$stateParams', 'Page', function($scope, $state, $stateParams, Page) {
	 
	$scope.processDefinitionKey = $stateParams.pk || '1';
	$scope.activitiKey = $stateParams.tk || '1';
	
	 $scope.todoGrid = {
				query : {
		 			processDefinitionKey : $scope.processDefinitionKey,
		 			taskDefinitionKey : $scope.activitiKey
		 	    },
		        column_defs: [
		            {
		            	target: 1,
						template: function (row) {
						     return '<a href="javascript:void(0);;" ed-click="browser">' + row.processInstanceId + '</a>'
						}
		            },{
		                target: 7,
		                buttons: [
		                    {
		                        name: '办理',
		                        class: 'btn-success',
		                        icon: 'fa-edit',
		                        event: function(row) {
		                            $state.go('auth.taskComplete', {task: row, taskId: row.id});
		                        }
		                    }
		                ]
		            }
		        ],
		        browser: function (row) {
		 			$state.go('auth.processView', {processInstanceId: row.processInstanceId});
		        }
	};
	 
	 $scope.doneGrid = {
				query : {
					processDefinitionKey : $scope.processDefinitionKey,
					taskDefinitionKey : $scope.activitiKey
			    },
		        column_defs: [
		            {
		            	target: 1,
						template: function (row) {
						     return '<a href="javascript:void(0);;" ed-click="browser">' + row.processInstanceId + '</a>'
						}
		            }
		        ],
		        browser: function (row) {
		 			$state.go('auth.processView', {processInstanceId: row.processInstanceId});
		        }
	 };
	 
	 $scope.dofinishedGrid = {
			 	query : {
					processDefinitionKey : $scope.processDefinitionKey,
					taskDefinitionKey : $scope.activitiKey
			    },
		        column_defs: [
		            {
					    target: 1,
					    template: function (row) {
					        return '<a href="javascript:void(0);;" ed-click="browser">' + row.processInstanceId + '</a>'
					    }
					}
		        ],
		        browser: function (row) {
		 			$state.go('auth.processView', {processInstanceId: row.processInstanceId});
	            }
	 };
	
}]);
